home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65 / src / sysexits.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-05  |  2.3 KB  |  75 lines

  1. /*
  2.  * Copyright (c) 1983 Eric P. Allman
  3.  * Copyright (c) 1988 Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms are permitted provided
  7.  * that: (1) source distributions retain this entire copyright notice and
  8.  * comment, and (2) distributions including binaries display the following
  9.  * acknowledgement:  ``This product includes software developed by the
  10.  * University of California, Berkeley and its contributors'' in the
  11.  * documentation or other materials provided with the distribution and in
  12.  * all advertising materials mentioning features or use of this software.
  13.  * Neither the name of the University nor the names of its contributors may
  14.  * be used to endorse or promote products derived from this software without
  15.  * specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  */
  20.  
  21. #ifndef lint
  22. static char sccsid[] = "@(#)sysexits.c    5.6 (Berkeley) 6/1/90";
  23. #endif /* not lint */
  24.  
  25. #include <sysexits.h>
  26.  
  27. /*
  28.  *  SYSEXITS.C -- error messages corresponding to sysexits.h
  29.  */
  30. char *SysExMsg[] = {
  31.     /* 64 USAGE */        "500 Bad usage",
  32.     /* 65 DATAERR */    "501 Data format error",
  33.     /* 66 NOINPUT */    "550 Cannot open input",
  34.     /* 67 NOUSER */        "550 User unknown",
  35.     /* 68 NOHOST */        "550 Host unknown",
  36.     /* 69 UNAVAILABLE */    "554 Service unavailable",
  37.     /* 70 SOFTWARE */    "554 Internal error",
  38.     /* 71 OSERR */        "451 Operating system error",
  39.     /* 72 OSFILE */        "554 System file missing",
  40.     /* 73 CANTCREAT */    "550 Can't create output",
  41.     /* 74 IOERR */        "451 I/O error",
  42.     /* 75 TEMPFAIL */    "250 Deferred",
  43.     /* 76 PROTOCOL */    "554 Remote protocol error",
  44.     /* 77 NOPERM */        "550 Insufficient permission",
  45.     /* 78 CONFIG */        "554 Local configuration error",
  46. };
  47.  
  48. int N_SysEx = sizeof(SysExMsg) / sizeof(SysExMsg[0]);
  49.  
  50. /*
  51.  *  STATSTRING -- return string corresponding to an error status
  52.  *
  53.  *    Parameters:
  54.  *        stat -- the status to decode.
  55.  *
  56.  *    Returns:
  57.  *        The string corresponding to that status
  58.  *
  59.  *    Side Effects:
  60.  *        none.
  61.  */
  62. char *
  63. statstring(stat)
  64.     int stat;
  65. {
  66.     static char ebuf[50];
  67.  
  68.     stat -= EX__BASE;
  69.     if (stat < 0 || stat >= N_SysEx) {
  70.         (void)sprintf(ebuf, "554 Unknown status %d", stat + EX__BASE);
  71.         return(ebuf);
  72.     }
  73.     return(SysExMsg[stat]);
  74. }
  75.